import Vue from 'vue'
import VueRouter from 'vue-router'
// import { component } from 'vue/types/umd'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login')
  },
  {
    path: '/',
    name: 'layout',
    redirect: '/home',
    component: () => import('@/views/layout/index.vue'),
    children: [
      {
        path: '/home',
        component: () => import('@/views/home/index.vue')
      },
      {
        path: '/qa',
        component: () => import('@/views/qa/index.vue')
      },
      {
        path: '/video',
        component: () => import('@/views/video/index.vue')
      },
      {
        path: '/my',
        component: () => import('@/views/my/index.vue')
      },
    ]
  },
  {
    path: '/search',
    component: () => import('@/views/search/index.vue')
  },
  { // 文章详情路由
    path: '/article/:aid',
    name: 'article',
    component: () => import('@/views/article/index.vue'),
    props: true
  }

]

const router = new VueRouter({
  routes
})

export default router
